package io.ouka.rule.engine;

import io.ouka.rule.domain.EngineResult;
import io.ouka.rule.domain.RuleTree;
import io.ouka.rule.domain.TreeNode;

import java.util.Map;

/**
 * Description:
 * User: Ouka
 * Date: 2020-06-08
 * Time: 22:09
 */
public class TreeEngineHandle extends BaseEngine {

    @Override
    public EngineResult process(Long treeId, RuleTree treeRich, Map<String, String> decisionMatter) {
        TreeNode treeNode = engineDecisionMaker(treeRich, treeId, decisionMatter);
        return new EngineResult(treeId, treeNode.getTreeNodeId(), treeNode.getNodeValue());
    }
}
